To use an ADC as the feedback for a servo loop select Axis Input Mode = ADC on the Configuration Screen.
You can specify Input Gains and Offsets. Setting a Gain of -1 would invert the input.
If you need to sum 2 inputs you would need to write a C Program to do this.
There is no direct support for that slow of a PWM output to an opto output. But you can do it with a C program something like shown below. Configure the servo axis as a dummy DAC output so the axis calculates the ch0->Output value, but have the C program use the value to control the opto output.
The added Kanalog I/O is described under the Kanalog Section here:
I hope this helps
TK
#include "KMotionDef.h" main() { int v,i=0,k; for (;;) { WaitNextTimeSlice();
v=ch0->Output; // desired output k = ((i&1) << 7)| // bit reverse i ((i&2) << 5)| ((i&4) << 3)| ((i&8) << 1)| ((i&16) >> 1)| ((i&32) >> 3)| ((i&64) >>
5)| ((i&128) >> 7); if (k >= v) SetBit(148); else ClearBit(148); i = ++i & 255; // 8 bit counter } }
Group: DynoMotion |
Message: 921 |
From: b.burig@yahoo.com |
Date: 2/16/2011 |
Subject: Re: Making analog servo with KFlop + Kanalog |
To get started I tried to read the values of ADC0 that I had a small voltage on JP6 ADC0 using the console command ADC0. result is always 0.
I used the console to set DACO=2000 and I can see that on the analog IO screen but not on JP11 DAC0.
What am I doing wrong.
Bob
--- In DynoMotion@yahoogroups.com, Tom Kerekes <tk@...> wrote:
>
> To use an ADC as the feedback for a servo loop select Axis Input Mode = ADC on
> the Configuration Screen.
>
> You can specify Input Gains and Offsets.  Setting a Gain of -1 would invert the
> input.
>
> If you need to sum 2 inputs you would need to write a C Program to do this.
>
> There is no direct support for that slow of a PWM output to an opto output. But
> you can do it with a C program something like shown below. Configure the servo
> axis as a dummy DAC output so the axis calculates the  ch0->Output value, but
> have the C program use the value to control the opto output.
>
> The added Kanalog I/O is described under the Kanalog Section here:
>
> http://www.dynomotion.com/Help
>
> I hope this helps
> TK
>
>
> #include "KMotionDef.h"
> main()
> {
> Â Â Â int v,i=0,k;
> Â
> Â Â Â for (;;)
> Â Â Â {
> Â Â Â Â Â Â Â WaitNextTimeSlice();
> Â Â Â Â Â Â Â v=ch0->Output;Â // desired output
> Â Â
> Â Â Â Â Â Â Â k = ((i&1)Â Â << 7)|Â // bit reverse i
> Â Â Â Â Â Â Â Â Â Â Â ((i&2)Â Â << 5)|
> Â Â Â Â Â Â Â Â Â Â Â ((i&4)Â Â << 3)|
> Â Â Â Â Â Â Â Â Â Â Â ((i&8)Â Â << 1)|
> Â Â Â Â Â Â Â Â Â Â Â ((i&16)Â >> 1)|
> Â Â Â Â Â Â Â Â Â Â Â ((i&32)Â >> 3)|
> Â Â Â Â Â Â Â Â Â Â Â ((i&64)Â >> 5)|
> Â Â Â Â Â Â Â Â Â Â Â ((i&128) >> 7);
> Â
> Â Â Â Â Â Â if (k >= v)
> Â Â Â Â Â Â Â Â Â Â Â SetBit(148);
> Â Â Â Â Â Â Â else
> Â Â Â Â Â Â Â Â Â Â Â ClearBit(148);
> Â Â
> Â Â Â Â Â Â Â i = ++i & 255;Â // 8 bit counter
> Â Â Â }
> }
>
>
> Â
>
>
>
> ________________________________
> From: "b.burig@..." <b.burig@...>
> To: DynoMotion@yahoogroups.com
> Sent: Wed, February 16, 2011 9:23:04 AM
> Subject: [DynoMotion] Making analog servo with KFlop + Kanalog
>
> Â
> I have no idea how to use the low voltage ADCs on JP12 of Kanalog board. Or how
> to set up an analog loop on the Kanalog. Servoes are not new to me, made
> hundreds of all types.
>
> Can I sum 2 inputs?
> Can I invert the polarity of an input?
>
> I want to make an analog servo with PID loop with analog command generated by a
> temperature monitoring device. This input would control the temperature loop by
> outputting a PWM signal (say less than 60 cycles) to an Opto output (say IO 148)
> to control a heater.
>
>
> In addition, I want to make another loop using a humidity sensor. It could be a
> simple on-off control, so I would set a reference, and read the input voltage
> (input to ADC) and compare to the reference. If needed this may need to expanded
> to PID loop as well.
>
> Is there a manual for Kanalog.
>
|
|
Group: DynoMotion |
Message: 922 |
From: Tom Kerekes |
Date: 2/16/2011 |
Subject: Re: Making analog servo with KFlop + Kanalog |
Hi Bob,
That sounds like a hardware problem. All it should take is power-up, then DAC0=2000, and JP11 DAC0 should change. If not, then there is a hardware problem. Note that if you have an axis enabled and it is writing to the DAC then it will immediately overwrite any DAC command sent from the Console, so make sure all axes are disabled when you perform the test.
Is the Kanalog LED on? One common problem is that KFLOP+Kanalog draws too much power to be USB powered. You must remove the KFLOP J3 jumper and supply external +5V.
Regards
TK
Group: DynoMotion |
Message: 923 |
From: b.burig@yahoo.com |
Date: 2/17/2011 |
Subject: Re: Making analog servo with KFlop + Kanalog |
Ah-ha. DACs do output to the terminal strip, but it can't be read by looking at the screw, I have to make contact to the wire clamp. That qualifies as a wiring error I guess.
ADCs stil can't be read by the Console using ADC<N> even though the Analog Status shows various input voltages present.
No power issue, I've been using external 500W computer Pwr Sup.
--- In DynoMotion@yahoogroups.com, Tom Kerekes <tk@...> wrote:
>
> Hi Bob,
>
> That sounds like a hardware problem. All it should take is power-up, then
> DAC0=2000, and JP11 DAC0 should change. If not, then there is a hardware
> problem. Note that if you have an axis enabled and it is writing to the DAC
> then it will immediately overwrite any DAC command sent from the Console, so
> make sure all axes are disabled when you perform the test.
>
> Is the Kanalog LED on? One common problem is that KFLOP+Kanalog draws too much
> power to be USB powered. You must remove the KFLOP J3 jumper and supply
> external +5V.
>
> Regards
> TK
>
>
>
>
> ________________________________
> From: "b.burig@..." <b.burig@...>
> To: DynoMotion@yahoogroups.com
> Sent: Wed, February 16, 2011 2:33:03 PM
> Subject: [DynoMotion] Re: Making analog servo with KFlop + Kanalog
>
> Â
> To get started I tried to read the values of ADC0 that I had a small voltage on
> JP6 ADC0 using the console command ADC0. result is always 0.
> I used the console to set DACO=2000 and I can see that on the analog IO screen
> but not on JP11 DAC0.
> What am I doing wrong.
> Bob
>
> --- In DynoMotion@yahoogroups.com, Tom Kerekes <tk@> wrote:
> >
> > To use an ADC as the feedback for a servo loop select AxisÃÂ InputÃÂ Mode = ADC
> >on
> >
> > the Configuration Screen.
> >
> > You can specify Input Gains andÃÂ Offsets.ÃÂ ÃÂ Setting a Gain of -1 would invert
> >the
> >
> > input.
> >
> > If you need to sum 2 inputs you would need to write a C Program to do this.
> >
> > There is no direct support for that slow of a PWM output to an opto output.ÃÂ
> >But
> >
> > you can do it with a C program something likeÃÂ shown below.ÃÂ Configure the
> >servo
> >
> > axis as a dummy DAC output so theÃÂ axis calculates the ÃÂ ch0->Output value, but
> >
> > have the C program use the value to control the opto output.
> >
> > The added Kanalog I/O is described under the Kanalog Section here:
> >
> > http://www.dynomotion.com/Help
> >
> > I hope this helps
> > TK
> >
> >
> > #include "KMotionDef.h"
> > main()
> > {
> > ÃÂ ÃÂ ÃÂ int v,i=0,k;
> > ÃÂ
> > ÃÂ ÃÂ ÃÂ for (;;)
> > ÃÂ ÃÂ ÃÂ {
> > ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ WaitNextTimeSlice();
> > ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ v=ch0->Output;ÃÂ // desired output
> > ÃÂ ÃÂ
> > ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ k = ((i&1)ÃÂ ÃÂ << 7)|ÃÂ // bit reverse i
> > ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ((i&2)ÃÂ ÃÂ << 5)|
> > ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ((i&4)ÃÂ ÃÂ << 3)|
> > ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ((i&8)ÃÂ ÃÂ << 1)|
> > ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ((i&16)ÃÂ >> 1)|
> > ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ((i&32)ÃÂ >> 3)|
> > ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ((i&64)ÃÂ >> 5)|
> > ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ((i&128) >> 7);
> > ÃÂ
> > ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ if (k >= v)
> > ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ SetBit(148);
> > ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ else
> > ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ClearBit(148);
> > ÃÂ ÃÂ
> > ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ i = ++i & 255;ÃÂ // 8 bit counter
> > ÃÂ ÃÂ ÃÂ }
> > }
> >
> >
> > ÃÂ
> >
> >
> >
> > ________________________________
> > From: "b.burig@" <b.burig@>
> > To: DynoMotion@yahoogroups.com
> > Sent: Wed, February 16, 2011 9:23:04 AM
> > Subject: [DynoMotion] Making analog servo with KFlop + Kanalog
> >
> > ÃÂ
> > I have no idea how to use the low voltage ADCs on JP12 of Kanalog board. Or how
> >
> > to set up an analog loop on the Kanalog. Servoes are not new to me, made
> > hundreds of all types.
> >
> > Can I sum 2 inputs?
> > Can I invert the polarity of an input?
> >
> > I want to make an analog servo with PID loop with analog command generated by a
> >
> > temperature monitoring device. This input would control the temperature loop by
> >
> > outputting a PWM signal (say less than 60 cycles) to an Opto output (say IO
> >148)
> >
> > to control a heater.
> >
> >
> > In addition, I want to make another loop using a humidity sensor. It could be a
> >
> > simple on-off control, so I would set a reference, and read the input voltage
> > (input to ADC) and compare to the reference. If needed this may need to
> >expanded
> >
> > to PID loop as well.
> >
> > Is there a manual for Kanalog.
> >
>
|
|
Group: DynoMotion |
Message: 924 |
From: Tom Kerekes |
Date: 2/17/2011 |
Subject: Re: Making analog servo with KFlop + Kanalog |
Hi Bob,
Yes I see a bug with the Console ADC Command. Sorry about that.
As a workaround just look at the Analog Status or run the program below to print the value.
Additionally if you configure an axis for ADC input you can display the ADC value as the Axis Position with the Pos<N> Console Command.
#include "KMotionDef.h"
main() { printf("ADC0=%d\n",ADC(0)); }
TK
| | | | | |